ActivePython 2.7.1.4 (ActiveState Software Inc.) based on
Python 2.7.1 (r271:86832, Feb  7 2011, 11:30:38) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> message='N,N,,E,,6,0,2,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,B,,,,M,U,0,0,1,0,0,0,1,0,0,0,0,S,A,1104,,,,,,H,F,U,U,M,B,30,,U,U,40,F,W,3,1,M,1,I,,11,91,2,,F01,Y,6,2,4,00,0,25,33,5,43,56,60.6,80,,Y,U,U,Y,Y,Y,0,00,0,00,1,,4,,Q,6,Y,,U,U,0,Y,40,,,,,,,,M,,,,,,,,H,,,,,,,,77,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,BARNSTABLE,026301500,MA,355588,1ST_PARTY,Y,10,64,64,1362,Sub Promo - Multi,"Thu, 11/18/10 12:39 PM"'
>>> str
<type 'str'>
>>> message
'N,N,,E,,6,0,2,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,B,,,,M,U,0,0,1,0,0,0,1,0,0,0,0,S,A,1104,,,,,,H,F,U,U,M,B,30,,U,U,40,F,W,3,1,M,1,I,,11,91,2,,F01,Y,6,2,4,00,0,25,33,5,43,56,60.6,80,,Y,U,U,Y,Y,Y,0,00,0,00,1,,4,,Q,6,Y,,U,U,0,Y,40,,,,,,,,M,,,,,,,,H,,,,,,,,77,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,BARNSTABLE,026301500,MA,355588,1ST_PARTY,Y,10,64,64,1362,Sub Promo - Multi,"Thu, 11/18/10 12:39 PM"'
>>> import re
>>> re.search(r'(^[^,]+)|("[^"]+)|([^,]+)|([^,]+$',message)

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    re.search(r'(^[^,]+)|("[^"]+)|([^,]+)|([^,]+$',message)
  File "C:\Python27\lib\re.py", line 142, in search
    return _compile(pattern, flags).search(string)
  File "C:\Python27\lib\re.py", line 245, in _compile
    raise error, v # invalid expression
error: unbalanced parenthesis
>>> re.search(r'(^[^,]+)|("[^"]+)|([^,]+)|([^,]+$)',message)
<_sre.SRE_Match object at 0x0209C288>
>>> s=re.search(r'(^[^,]+)|("[^"]+)|([^,]+)|([^,]+$)',message)
>>> s.expand
<built-in method expand of _sre.SRE_Match object at 0x020B3758>
>>> s.expand()

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    s.expand()
TypeError: expand() takes exactly one argument (0 given)
>>> s.groupdict()
{}
>>> s.gr

Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    s.gr
AttributeError: gr
>>> s.group(1)
'N'
>>> s.group(2)
>>> s.group(3)
>>> s.group(4)
>>> import os
>>> csvfile=csv.reader(open('c:\Hearst\Modeling_1.csv'),delimiter=',',quotechar='"')

Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    csvfile=csv.reader(open('c:\Hearst\Modeling_1.csv'),delimiter=',',quotechar='"')
NameError: name 'csv' is not defined
>>> import csv
>>> csvfile=csv.reader(open('c:\Hearst\Modeling_1.csv'),delimiter=',',quotechar='"')
>>> s=csvfile.line_num(1)

Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    s=csvfile.line_num(1)
TypeError: 'long' object is not callable
>>> type(csvfile)
<type '_csv.reader'>
>>> csvfile[1]

Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    csvfile[1]
TypeError: '_csv.reader' object is not subscriptable
>>> csvfile.next()
['CLICK_FLG', 'OPEN_FLG', 'ADDR_VER_CD', 'AQI', 'ASIAN_CD', 'AUTO_IN_MARKET', 'BIRD_QTY', 'BUYER_DM_BOOKS', 'BUYER_DM_COLLECT_SPC_FOOD', 'BUYER_DM_CRAFTS_HOBBI', 'BUYER_DM_FEMALE_ORIEN', 'BUYER_DM_GARDEN_FARM', 'BUYER_DM_GENERAL', 'BUYER_DM_GIFT_GADGET', 'BUYER_DM_MALE_ORIEN', 'BUYER_DM_UPSCALE', 'BUYER_MAG_CULINARY_INTERS', 'BUYER_MAG_FAMILY_GENERAL', 'BUYER_MAG_FEMALE_ORIENTED', 'BUYER_MAG_GARDEN_FARMING', 'BUYER_MAG_HEALTH_FITNESS', 'BUYER_MAG_MALE_SPORT_ORIENTED', 'BUYER_MAG_RELIGIOUS', 'CATS_QTY', 'CEN_2000_MATCH_LEVEL', 'CLUB_MEMBER_CD', 'COUNTRY_OF_ORIGIN', 'DECEASED_INDICATOR', 'DM_RESPONDER_HH', 'DM_RESPONDER_INDIV', 'DMR_CONTRIB_CAT_GENERAL', 'DMR_CONTRIB_CAT_HEALTH_INST', 'DMR_CONTRIB_CAT_POLITICAL', 'DMR_CONTRIB_CAT_RELIGIOUS', 'DMR_DO_IT_YOURSELFERS', 'DMR_MISCELLANEOUS', 'DMR_NEWS_FINANCIAL', 'DMR_ODD_ENDS', 'DMR_PHOTOGRAPHY', 'DMR_SWEEPSTAKES', 'DOG_QTY', 'DWELLING_TYPE', 'DWELLING_UNIT_SIZE', 'EST_LOAN_VALUE_RATIO', 'ETECH_GROUP', 'ETHNIC_GROUP_CODE', 'ETHNIC_INSIGHT_MTCH_FLG', 'ETHNICITY_DETAIL', 'EXPERIAN_INCOME_CD', 'EXPERIAN_INCOME_CD_V4', 'GNDR_OF_CHLDRN_0_3', 'GNDR_OF_CHLDRN_10_12', 'GNDR_OF_CHLDRN_13_18', 'GNDR_OF_CHLDRN_4_6', 'GNDR_OF_CHLDRN_7_9', 'HH_INCOME', 'HHLD_DM_PURC_CD', 'HOME_BUSINESS_IND', 'I1_BUSINESS_OWNER_FLG', 'I1_EXACT_AGE', 'I1_GNDR_CODE', 'I1_INDIV_HHLD_STATUS_CODE', 'INDIV_EDUCATION', 'INDIV_EDUCATION_CONF_LVL', 'INDIV_MARITAL_STATUS', 'INDIV_MARITAL_STATUS_CONF_LVL', 'INS_MATCH_TYPE', 'LANGUAGE', 'LENGTH_OF_RESIDENCE', 'MEDIAN_HOUSING_VALUE', 'MEDIAN_LEN_OF_RESIDENCE', 'MM_INCOME_CD', 'MOSAIC_HH', 'MULTI_BUYER_INDIV', 'NEW_CAR_MODEL', 'NUM_OF_ADULTS_IN_HHLD', 'NUMBER_OF_CHLDRN_18_OR_LESS', 'OCCUP_DETAIL', 'OCCUP_MIX_PCT', 'PCT_CHLDRN', 'PCT_DEROG_TRADES', 'PCT_HOUSEHOLDS_BLACK', 'PCT_OWNER_OCCUPIED', 'PCT_RENTER_OCCUPIED', 'PCT_TRADES_NOT_DEROG', 'PCT_WHITE', 'PHONE_TYPE_CD', 'PRES_OF_CHLDRN_0_3', 'PRES_OF_CHLDRN_10_12', 'PRES_OF_CHLDRN_13_18', 'PRES_OF_CHLDRN_4_6', 'PRES_OF_CHLDRN_7_9', 'PRESENCE_OF_CHLDRN', 'PRIM_FEM_EDUC_CD', 'PRIM_FEM_OCC_CD', 'PRIM_MALE_EDUC_CD', 'PRIM_MALE_OCC_CD', 'RECIPIENT_RELIABILITY_CD', 'RELIGION', 'SCS_MATCH_TYPE', 'TRW_INCOME_CD', 'TRW_INCOME_CD_V4', 'USED_CAR_CD', 'Y_OWNS_HOME', 'Y_PROBABLE_HOMEOWNER', 'Y_PROBABLE_RENTER', 'Y_RENTER', 'YRS_SCHOOLING_CD', 'Z_CREDIT_CARD', 'age_hh_mem1', 'age_hh_mem2', 'age_hh_mem3', 'age_hh_mem4', 'age_hh_mem5', 'age_hh_mem6', 'age_hh_mem7', 'age_hh_mem8', 'gender_hh_mem1', 'gender_hh_mem2', 'gender_hh_mem3', 'gender_hh_mem4', 'gender_hh_mem5', 'gender_hh_mem6', 'gender_hh_mem7', 'gender_hh_mem8', 'statcd_hh_mem1', 'statcd_hh_mem2', 'statcd_hh_mem3', 'statcd_hh_mem4', 'statcd_hh_mem5', 'statcd_hh_mem6', 'statcd_hh_mem7', 'statcd_hh_mem8', 'trait_cd1', 'trait_cd2', 'trait_cd3', 'trait_cd4', 'trait_cd5', 'trait_cd6', 'trait_cd7', 'trait_cd8', 'trait_cd9', 'trait_cd10', 'trait_cd11', 'trait_cd12', 'trait_cd13', 'trait_cd14', 'trait_cd15', 'trait_cd16', 'trait_cd17', 'trait_cd18', 'trait_cd19', 'trait_cd20', 'trait_cd21', 'trait_cd22', 'trait_cd23', 'trait_cd24', 'trait_cd25', 'trait_cd26', 'trait_cd27', 'trait_cd28', 'trait_cd29', 'trait_cd30', 'trait_cd31', 'trait_cd32', 'trait_cd33', 'trait_cd34', 'trait_cd35', 'trait_cd36', 'trait_cd37', 'trait_cd38', 'trait_cd39', 'trait_cd40', 'trait_cd41', 'trait_cd42', 'trait_cd43', 'trait_cd44', 'trait_cd45', 'trait_cd46', 'trait_cd47', 'trait_cd48', 'trait_cd49', 'trait_cd50', 'trait_cd51', 'trait_cd52', 'trait_cd53', 'trait_cd54', 'trait_cd55', 'trait_cd56', 'trait_cd57', 'trait_cd58', 'trait_cd59', 'trait_cd60', 'trait_cd61', 'trait_cd62', 'trait_cd63', 'trait_cd64', 'trait_typ_cd1', 'trait_typ_cd2', 'trait_typ_cd3', 'trait_typ_cd4', 'trait_typ_cd5', 'trait_typ_cd6', 'trait_typ_cd7', 'trait_typ_cd8', 'trait_typ_cd9', 'trait_typ_cd10', 'trait_typ_cd11', 'trait_typ_cd12', 'trait_typ_cd13', 'trait_typ_cd14', 'trait_typ_cd15', 'trait_typ_cd16', 'trait_typ_cd17', 'trait_typ_cd18', 'trait_typ_cd19', 'trait_typ_cd20', 'trait_typ_cd21', 'trait_typ_cd22', 'trait_typ_cd23', 'trait_typ_cd24', 'trait_typ_cd25', 'trait_typ_cd26', 'trait_typ_cd27', 'trait_typ_cd28', 'trait_typ_cd29', 'trait_typ_cd30', 'trait_typ_cd31', 'trait_typ_cd32', 'trait_typ_cd33', 'trait_typ_cd34', 'trait_typ_cd35', 'trait_typ_cd36', 'trait_typ_cd37', 'trait_typ_cd38', 'trait_typ_cd39', 'trait_typ_cd40', 'trait_typ_cd41', 'trait_typ_cd42', 'trait_typ_cd43', 'trait_typ_cd44', 'trait_typ_cd45', 'trait_typ_cd46', 'trait_typ_cd47', 'trait_typ_cd48', 'trait_typ_cd49', 'trait_typ_cd50', 'trait_typ_cd51', 'trait_typ_cd52', 'trait_typ_cd53', 'trait_typ_cd54', 'trait_typ_cd55', 'trait_typ_cd56', 'trait_typ_cd57', 'trait_typ_cd58', 'trait_typ_cd59', 'trait_typ_cd60', 'trait_typ_cd61', 'trait_typ_cd62', 'trait_typ_cd63', 'trait_typ_cd64', 'CITY', 'POSTAL_CD', 'STATE_PROVINCE', 'new_id', 'list_auth_cd', 'list_auth_flg', 'new_list_id', 'list_new_brand_cd', 'list_new_ed_cd', 'new_mailing_id', 'Mailing_Category', 'Mailed_Date']
>>> csvfile.ne

Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    csvfile.ne
AttributeError: '_csv.reader' object has no attribute 'ne'
>>> csvfile.next()
['N', 'N', '', 'G', '', '8', '0', '1', '0', '0', '0', '0', '1', '0', '0', '0', '0', '4', '0', '0', '1', '0', '0', '0', 'B', 'U', '0', '', 'M', 'Y', '0', '0', '0', '0', '0', '1', '1', '1', '0', '2', '0', 'A', 'C', '0', 'J', '18', 'Y', '66', '', 'A', 'U', 'U', 'U', 'U', 'U', '34', '', 'U', 'U', '84', 'M', 'H', '1', '1', 'M', '5', 'I', '01', '00', '67', '3', '', 'E06', 'Y', '7', '3', '0', '05', '0', '37', '78.09', '30', '63', '36', '13.27', '59', '', 'N', 'N', 'N', 'N', 'N', 'N', 'U', 'UU', 'U', '07', '6', 'J', '4', '', 'J', '4', 'U', '', 'Y', 'U', '0', 'Y', '', '24', '', '', '', '', '', '', 'F', 'F', '', '', '', '', '', '', 'U', 'Y', '', '', '', '', '', '', '17', '69', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'NORTH LAUDERDALE', '330685141', 'FL', '190815', '', '', '', '', '', '1036', 'Third Party - Merch', 'Mon, 09/20/10 01:04 PM']
>>> len(csvfile.next())
273
>>> os.listdir('c:\Hearst
	   
SyntaxError: EOL while scanning string literal
>>> os.listdir('c:\Hearst`)
	   
SyntaxError: EOL while scanning string literal
>>> os.listdir('c:\Hearst')
['data_dictionary_2011.pdf', 'data_dictionary_2011.txt', 'Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation.csv', 'validation_template.csv']
>>> os.listdir('c:\Hearst\*csv')

Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    os.listdir('c:\Hearst\*csv')
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'c:\\Hearst\\*csv/*.*'
>>> from dateutil import parser
>>> dt=parser.parse('Mon, 09/20/10 01:04 PM')
>>> dt
datetime.datetime(2010, 9, 20, 13, 4)
>>> dt.isoformat()
'2010-09-20T13:04:00'
>>> import datetime
>>> datetime.strftime()

Traceback (most recent call last):
  File "<pyshell#35>", line 1, in <module>
    datetime.strftime()
AttributeError: 'module' object has no attribute 'strftime'
>>> strftime

Traceback (most recent call last):
  File "<pyshell#36>", line 1, in <module>
    strftime
NameError: name 'strftime' is not defined
>>> import time
>>> time.strftime("%a, %m/%d/%y %H:%M %p",dt)

Traceback (most recent call last):
  File "<pyshell#38>", line 1, in <module>
    time.strftime("%a, %m/%d/%y %H:%M %p",dt)
TypeError: argument must be 9-item sequence, not datetime.datetime
>>> dt.time()
datetime.time(13, 4)
>>> time.strftime("%a, %m/%d/%y %H:%M %p",dt.time())

Traceback (most recent call last):
  File "<pyshell#40>", line 1, in <module>
    time.strftime("%a, %m/%d/%y %H:%M %p",dt.time())
TypeError: argument must be 9-item sequence, not datetime.time
>>> db=time.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
>>> db
time.struct_time(tm_year=2010, tm_mon=9, tm_mday=20, tm_hour=1, tm_min=4, tm_sec=0, tm_wday=0, tm_yday=263, tm_isdst=-1)
>>> time.strftime("%a, %m/%d/%y %H:%M %p",db)
'Mon, 09/20/10 01:04 AM'
>>> db=time.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %I:%M %p")
>>> time.strftime("%a, %m/%d/%y %H:%M %p",db)
'Mon, 09/20/10 13:04 PM'
>>> time.strftime("%a, %m/%d/%y %I:%M %p",db)
'Mon, 09/20/10 01:04 PM'
>>> dt.strftime("%a, %m/%d/%y %I:%M %p")
'Mon, 09/20/10 01:04 PM'
>>> db=datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")

Traceback (most recent call last):
  File "<pyshell#48>", line 1, in <module>
    db=datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
AttributeError: 'module' object has no attribute 'strptime'
>>> from datetime import datetime, date, time
>>> db=datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
>>> db=datetime.datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")

Traceback (most recent call last):
  File "<pyshell#51>", line 1, in <module>
    db=datetime.datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
>>> from datetime import datetime, date, timeAttributeError: type object 'datetime.datetime' has no attribute 'datetime'
SyntaxError: invalid syntax
>>> from datetime import datetime, date, time
>>> db=datetime.datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")

Traceback (most recent call last):
  File "<pyshell#54>", line 1, in <module>
    db=datetime.datetime.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
>>> db
datetime.datetime(2010, 9, 20, 1, 4)
>>> db.u

Traceback (most recent call last):
  File "<pyshell#56>", line 1, in <module>
    db.u
AttributeError: 'datetime.datetime' object has no attribute 'u'
>>> db.utcfromtimestamp()

Traceback (most recent call last):
  File "<pyshell#57>", line 1, in <module>
    db.utcfromtimestamp()
TypeError: utcfromtimestamp() takes exactly 1 argument (0 given)
>>> db.utcfromtimestamp(1)
datetime.datetime(1970, 1, 1, 0, 0, 1)
>>> db.time()
datetime.time(1, 4)
>>> int(db.time())

Traceback (most recent call last):
  File "<pyshell#60>", line 1, in <module>
    int(db.time())
TypeError: int() argument must be a string or a number, not 'datetime.time'
>>> int(db.time()+5)

Traceback (most recent call last):
  File "<pyshell#61>", line 1, in <module>
    int(db.time()+5)
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int'
>>> time.mktime(db.timetuple())

Traceback (most recent call last):
  File "<pyshell#62>", line 1, in <module>
    time.mktime(db.timetuple())
AttributeError: type object 'datetime.time' has no attribute 'mktime'
>>> import time as tim
>>> tim.mktime(db.timetuple())
1284924840.0
>>> print repr(tim.mktime(db.timetuple()))
1284924840.0
>>> time.strftime("%a, %m/%d/%y %I:%M:s %p",db)

Traceback (most recent call last):
  File "<pyshell#66>", line 1, in <module>
    time.strftime("%a, %m/%d/%y %I:%M:s %p",db)
TypeError: descriptor 'strftime' requires a 'datetime.time' object but received a 'str'
>>> 
>>> dn

Traceback (most recent call last):
  File "<pyshell#68>", line 1, in <module>
    dn
NameError: name 'dn' is not defined
>>> db
datetime.datetime(2010, 9, 20, 1, 4)
>>> datetime.strftime("%a, %m/%d/%y %I:%M:s %p",db)

Traceback (most recent call last):
  File "<pyshell#70>", line 1, in <module>
    datetime.strftime("%a, %m/%d/%y %I:%M:s %p",db)
TypeError: descriptor 'strftime' requires a 'datetime.date' object but received a 'str'
>>> db
datetime.datetime(2010, 9, 20, 1, 4)
>>> db=time.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")

Traceback (most recent call last):
  File "<pyshell#72>", line 1, in <module>
    db=time.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
AttributeError: type object 'datetime.time' has no attribute 'strptime'
>>> db=tim.strptime('Mon, 09/20/10 01:04 PM',"%a, %m/%d/%y %H:%M %p")
>>> tim.strftime("%a, %m/%d/%y %I:%M:s %p",db)
'Mon, 09/20/10 01:04:s AM'
>>> tim.strftime("%a, %m/%d/%y %I:%M:%s %p",db)

Traceback (most recent call last):
  File "<pyshell#75>", line 1, in <module>
    tim.strftime("%a, %m/%d/%y %I:%M:%s %p",db)
ValueError: Invalid format string
>>> tim.strftime("%a, %m/%d/%y %I:%M:%S %p",db)
'Mon, 09/20/10 01:04:00 AM'
>>> tim.strftime("%m/%d/%y %H:%M:%S",db)
'09/20/10 01:04:00'
>>> int('A')

Traceback (most recent call last):
  File "<pyshell#78>", line 1, in <module>
    int('A')
ValueError: invalid literal for int() with base 10: 'A'
>>> int('10')
10
>>> s='A'
>>> s.atoi()

Traceback (most recent call last):
  File "<pyshell#81>", line 1, in <module>
    s.atoi()
AttributeError: 'str' object has no attribute 'atoi'
>>> try:
	s=int('A')
    except ValueError,e:
	    
  File "<pyshell#85>", line 3
    except ValueError,e:
                       ^
IndentationError: unindent does not match any outer indentation level
>>> try:
	s=int('A')except ValueError,e:
		
SyntaxError: invalid syntax
>>> try:
	s=int('A')except ValueError,e:
		
SyntaxError: invalid syntax
>>> try:
	s=int('A')
except ValueError,e:
	print e

	
invalid literal for int() with base 10: 'A'
>>> try:
	s=int('A')
except ValueError,e:
	print e
else
SyntaxError: invalid syntax
>>> try:
	s=int('A')
except ValueError,e:
	print e
else:
	print 'i am here'

	
invalid literal for int() with base 10: 'A'
>>> try:
	s=int('10')
except ValueError,e:
	print e
else:
	print 'i am here'

	
i am here
>>> try:
	s=int('10')
except ValueError,e:
	print e
finally:
	print 'i am here'

	
i am here
>>> try:
	s=int('10N')
except ValueError,e:
	print e
finally:
	print 'i am here'

	
invalid literal for int() with base 10: '10N'
i am here
>>> h=csvfile.next()
>>> h
['N', 'N', '', 'E', '', '8', '0', '3', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4', '0', '0', '0', 'B', '', '0', '', 'M', 'U', '0', '0', '0', '0', '1', '1', '0', '2', '0', '1', '0', 'A', 'H', '1087', 'K', '8', 'Y', '01', '', 'F', 'U', 'U', 'U', 'U', 'U', '71', '', 'U', 'U', '62', 'M', 'H', '4', '5', 'M', '5', 'I', '01', '05', '293', '2', '', 'A04', 'Y', '3', '7', '0', '00', '0', '5', '4.73', '7', '63', '36', '87.5', '90', '', 'N', 'N', 'N', 'N', 'N', 'N', '0', '00', '0', '00', '1', 'P', '4', '', 'O', '7', 'Y', '', 'U', 'U', '0', 'Y', '', '', '', '', '61', '', '', '', 'F', 'U', 'F', 'U', 'F', 'M', '', '', 'U', 'U', 'U', 'U', 'U', 'Y', '', '', '17', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'ATLANTA', '303093562', 'GA', '182292', '', '', '', '', '', '1036', 'Third Party - Merch', 'Mon, 09/20/10 01:04 PM']
>>> import fnmatch
>>> h=os.listdir('c:\Hearst\*csv')

Traceback (most recent call last):
  File "<pyshell#109>", line 1, in <module>
    h=os.listdir('c:\Hearst\*csv')
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'c:\\Hearst\\*csv/*.*'
>>> h=os.listdir('c:\Hearst')
>>> h
['data_dictionary_2011.pdf', 'data_dictionary_2011.txt', 'Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation.csv', 'validation_template.csv']
>>> for i,k in enumerate(h):
	if i==fnmatch.fnmatch('*csv'):
		pass
	else
	
SyntaxError: invalid syntax
>>> for i,k in enumerate(h):
	if i==fnmatch.fnmatch('*csv'):
		pass
	else:
		del h[k]

		

Traceback (most recent call last):
  File "<pyshell#118>", line 2, in <module>
    if i==fnmatch.fnmatch('*csv'):
TypeError: fnmatch() takes exactly 2 arguments (1 given)
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(i,'*csv'):
		pass
	else:
		del h[k]

		

Traceback (most recent call last):
  File "<pyshell#120>", line 2, in <module>
    if fnmatch.fnmatch(i,'*csv'):
  File "C:\Python27\lib\fnmatch.py", line 41, in fnmatch
    name = os.path.normcase(name)
  File "C:\Python27\lib\ntpath.py", line 46, in normcase
    return s.replace("/", "\\").lower()
AttributeError: 'int' object has no attribute 'replace'
>>> for i,k in enumerate(h):
	print i

	
0
1
2
3
4
5
6
7
>>> for i,k in enumerate(h):
	print k

	
data_dictionary_2011.pdf
data_dictionary_2011.txt
Modeling_1.csv
Modeling_2.csv
Modeling_3.csv
Modeling_4.csv
validation.csv
validation_template.csv
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'*csv'):
		pass
	else:
		del h[i]

		
>>> h
['data_dictionary_2011.txt', 'Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation.csv', 'validation_template.csv']
>>> del h[0]
>>> h
['Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation.csv', 'validation_template.csv']
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'Model*csv'):
		pass
	else:
		del h[i]

		
>>> h
['Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation_template.csv']
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'Model*csv'):
		pass
	else:
		print h[i]del h[i]
		
SyntaxError: invalid syntax
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'Model*csv'):
		pass
	else:
		print h[i]
		del h[i]

		
validation_template.csv
>>> h
['Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv']
>>> h=os.listdir('c:\Hearst')
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'Model*csv'):
		pass
	else:
		print h[i]
		del h[i]

		
data_dictionary_2011.pdf
validation.csv
>>> h
['data_dictionary_2011.txt', 'Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation_template.csv']
>>> rem=[]
>>> for i,k in enumerate(h):
	if fnmatch.fnmatch(k,'Model*csv'):
		pass
	else:
		rem.append(i)

		
>>> rem
[0, 5]
>>> h.remove(rem)

Traceback (most recent call last):
  File "<pyshell#147>", line 1, in <module>
    h.remove(rem)
ValueError: list.remove(x): x not in list
>>> for i in rem:
	h.remove(i)

	

Traceback (most recent call last):
  File "<pyshell#150>", line 2, in <module>
    h.remove(i)
ValueError: list.remove(x): x not in list
>>> for i in rem:
	del h[i]

	

Traceback (most recent call last):
  File "<pyshell#152>", line 2, in <module>
    del h[i]
IndexError: list assignment index out of range
>>> h
['Modeling_1.csv', 'Modeling_2.csv', 'Modeling_3.csv', 'Modeling_4.csv', 'validation_template.csv']
>>> h=csvfile.next()
>>> h
['N', 'N', '', 'E', '', '7', '0', '0', '0', '0', '0', '0', '1', '1', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', 'B', 'U', '0', '', 'M', 'Y', '0', '2', '0', '0', '0', '1', '0', '2', '0', '2', '0', 'S', 'A', '3028', 'G', '27', 'Y', '03', '', 'J', 'U', 'U', 'U', 'U', 'U', '125', '', 'U', 'U', '57', 'M', 'H', '3', '5', 'M', '1', 'I', '01', '18', '443', '14', '', 'A01', 'Y', '2', '4', '0', '22', '0', '40', '0', '1', '92', '7', '97.27', '86', '', 'N', 'N', 'N', 'N', 'N', 'N', '4', 'UU', 'U', 'UU', '1', 'P', '4', '', 'R', '9', 'Y', '', 'U', 'U', '0', 'Y', '60', '25', '23', '', '', '', '', '', 'F', 'F', 'M', '', '', '', '', '', 'W', 'Y', 'Y', '', '', '', '', '', '14', '23', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '5', '5', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'BETHESDA', '208176164', 'MD', '152811', '', '', '', '', '', '1036', 'Third Party - Merch', 'Mon, 09/20/10 01:04 PM']
>>> h[17]
'1'
>>> h[7:22]
['0', '0', '0', '0', '0', '1', '1', '0', '0', '0', '1', '1', '0', '0', '0']
>>> h.index('U',:)
SyntaxError: invalid syntax
>>> h.index('U',::)
SyntaxError: invalid syntax
>>> h.index('U',0:274)
SyntaxError: invalid syntax
>>> h.index('U')
25
>>> h[25]
'U'
>>> 
>>> 
>>> import string
>>> allTheLetters = string.lowercase
>>> allTheLetters
'abcdefghijklmnopqrstuvwxyz\x83\x9a\x9c\x9e\xaa\xb5\xba\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
>>> ord('a)
    
SyntaxError: EOL while scanning string literal
>>> ord('a')
97
>>> ord('A')
65
>>> s='asa'
>>> s[0]
'a'
>>> s[1]
's'
>>> ord('1')
49
>>> ord('a')
97
>>> char(49)

Traceback (most recent call last):
  File "<pyshell#176>", line 1, in <module>
    char(49)
NameError: name 'char' is not defined
>>> chr(49)
'1'
>>> p={}
>>> for i in xrange(0,10):
	p[str(i)]=i

	
>>> p
{'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8}
>>> for i in xrange(ord('a'),ord('z')+1):
	p[chr(i)]=i

	
>>> p
{'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 97, 'c': 99, 'b': 98, 'e': 101, 'd': 100, 'g': 103, 'f': 102, 'i': 105, 'h': 104, 'k': 107, 'j': 106, 'm': 109, 'l': 108, 'o': 111, 'n': 110, 'q': 113, 'p': 112, 's': 115, 'r': 114, 'u': 117, 't': 116, 'w': 119, 'v': 118, 'y': 121, 'x': 120, 'z': 122}
>>> for i,k in enumerate(xrange(1,5)):
	print i,k

	
0 1
1 2
2 3
3 4
>>> del p
>>> p={}
>>> for i in xrange(0,10):
	p[str(i)]=i

	
>>> for i,k in enumerate(xrange(ord('a'),ord('z')+1)):
	p[chr(i)]=k

	
>>> p['u']=0
>>> p
{'\x01': 98, '\x00': 97, '\x03': 100, '\x02': 99, '\x05': 102, '\x04': 101, '\x07': 104, '\x06': 103, '\t': 106, '\x08': 105, '\x0b': 108, '\n': 107, '\r': 110, '\x0c': 109, '\x0f': 112, '\x0e': 111, '\x11': 114, '\x10': 113, '\x13': 116, '\x12': 115, '\x15': 118, '\x14': 117, '\x17': 120, '\x16': 119, '\x19': 122, '\x18': 121, '1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'u': 0}
>>> del p
>>> for i,k in enumerate(xrange(1,5)):
	print i,k

	
0 1
1 2
2 3
3 4
>>> for i in xrange(0,10):
	p[str(i)]=i

	

Traceback (most recent call last):
  File "<pyshell#202>", line 2, in <module>
    p[str(i)]=i
NameError: name 'p' is not defined
>>> p={}
\
>>> p
{}
>>> for i in xrange(0,10):
	p[str(i)]=i

	
>>> for i,k in enumerate(xrange(ord('a'),ord('z')+1)):
	p[chr(k)]=i

	
>>> p
{'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 0, 'c': 2, 'b': 1, 'e': 4, 'd': 3, 'g': 6, 'f': 5, 'i': 8, 'h': 7, 'k': 10, 'j': 9, 'm': 12, 'l': 11, 'o': 14, 'n': 13, 'q': 16, 'p': 15, 's': 18, 'r': 17, 'u': 20, 't': 19, 'w': 22, 'v': 21, 'y': 24, 'x': 23, 'z': 25}
>>> p['u']=0
>>> for i,k in enumerate(xrange(ord('a'),ord('z')+1)):
	p[chr(k)]=9+i+1

	
>>> p
{'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 10, 'c': 12, 'b': 11, 'e': 14, 'd': 13, 'g': 16, 'f': 15, 'i': 18, 'h': 17, 'k': 20, 'j': 19, 'm': 22, 'l': 21, 'o': 24, 'n': 23, 'q': 26, 'p': 25, 's': 28, 'r': 27, 'u': 30, 't': 29, 'w': 32, 'v': 31, 'y': 34, 'x': 33, 'z': 35}
>>> p['u']=0
>>> p['']=0
>>> p
{'': 0, '1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 10, 'c': 12, 'b': 11, 'e': 14, 'd': 13, 'g': 16, 'f': 15, 'i': 18, 'h': 17, 'k': 20, 'j': 19, 'm': 22, 'l': 21, 'o': 24, 'n': 23, 'q': 26, 'p': 25, 's': 28, 'r': 27, 'u': 0, 't': 29, 'w': 32, 'v': 31, 'y': 34, 'x': 33, 'z': 35}
>>> str='A05'
>>> d=0
>>> for i,k in str:
	d=d+(i+1)*p[k]

	

Traceback (most recent call last):
  File "<pyshell#221>", line 1, in <module>
    for i,k in str:
ValueError: need more than 1 value to unpack
>>> p['a']
10
>>> for i,k in str:
	print k

	

Traceback (most recent call last):
  File "<pyshell#225>", line 1, in <module>
    for i,k in str:
ValueError: need more than 1 value to unpack
>>> for i in str:
	print i

	
A
0
5
>>> for i,k in enumerate(str):
	d=d+(i+1)*p[k]

	

Traceback (most recent call last):
  File "<pyshell#230>", line 2, in <module>
    d=d+(i+1)*p[k]
KeyError: 'A'
>>> for i,k in enumerate(str):
	d=d+(i+1)*p[k.lower()]

	
>>> d
25
>>> str=''
>>> def strToNum(s):
	d=0
	for i,k in enumerate(s):
		d=d+(i+1)*p[k.lower()]
	return d

>>> strToNum('')
0
>>> strToNum('AAA')
60
>>> strToNum('ABC')
68
>>> strToNum('AB')
32
>>> strToNum('BA')
31
>>> strToNum('ABC')
68
>>> strToNum('ACB')
67
>>> strToNum('CBA')
64
>>> 
